﻿@using Ed.Entity
@using Ed.Web.Helpers
@model  List<Dictionary<string, object>>
@{
    Layout = null; 
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>雪绒花_添加订单</title>
    <link href="../../../../Themes/default/home/css/index.css" rel="stylesheet" type="text/css" />
    <link href="/Themes/default/lib/artDialog/css/ui-dialog.css" rel="stylesheet" />
    <script src="~/Themes/default/lib/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/Themes/default/lib/artDialog/dist/dialog-plus-min.js"></script>
    <script src="/Themes/default/lib/function.js"></script>
</head>
<body>
    <script type="text/javascript">
        //        $(document).ready(function () {
        //            //去除加载中
        //            if (undefined != top.dialog.list["show_loading"]) {
        //                top.dialog.list["show_loading"].close().remove();
        //                //showTopMsg("页面加载成功！", "温馨提示", "Success");
        //            }
        //            var mid = "@ViewBag.MoudleId";
        //            switch (mid) {
        //                case "1":
        //                    show_client();
        //                    break;
        //                case "2":
        //                    show_order();
        //                    break;
        //                case "3":
        //                    show_yuesao();
        //                    break;
        //                case "4":
        //                    show_finance();
        //                    break;
        //                case "5":
        //                    show_settings();
        //                    break;
        //                default:
        //                    break;
        //            }
        //        });
        $(function () {
            var m;
            $(".main li").hover(function () {
                m = $(this).index();
                $(".main li img").eq(m).animate({ width: "110px", marginTop: "0px" }, 200).animate({ width: "100px", marginTop: "5px" }, 200);
            }, function () {
                m = $(this).index();
                $(".main li img").eq(m).animate({ width: "90px", marginTop: "10px" }, 0);
            });

            var len = $(".main ul li").length;
            //alert(len);
            var wid = 182 * len;
            $(".main ul").css("width", wid + "px");
        });

        $(function () {
            $(".current-nav").mouseenter(function () {
                $(this).fadeOut(100, function () { $(".sidebar").animate({ left: "0" }, 300); });
            });
            $(".sidebar").mouseleave(function () {
                $(this).animate({ left: "-140px" }, 300, function () { $(".current-nav").fadeIn(0); });
            });
            var n;
            $(".sidebar li").hover(function () {
                n = $(this).index();
                $(".sidebar li img").eq(n).animate({ width: "70px", paddingTop: "0px" }, 200).animate({ width: "60px", paddingTop: "5px" }, 200);
            }, function () {
                n = $(this).index();
                $(".sidebar li img").eq(n).animate({ width: "50px", paddingTop: "10px" }, 0);
            });
        });


        //        function show_add() {
        //            showTopWindow("show_add_client", "/Customer/ClientInfo/Add?actionType=Add", null, 800, 380, function () {
        //                var client_form = $(top.window.frames["frm_show_add_client"].document).find("#clientinfo_form");
        //                var flag = top.document.getElementById("frm_show_add_client").contentWindow.form_valid();
        //                if (!flag) {
        //                    return false;
        //                }
        //                //var data = $(client_form).serializeObject();
        //                var data = $(client_form).serialize();
        //                //console.log(data);
        //                //return;
        //                $.ajax({
        //                    type: "POST",
        //                    cache: false,
        //                    url: "/api/ClientInfoApi/AddClientInfo/",
        //                    data: data,
        //                    dataType: "json",
        //                    beforeSend: function () {
        //                        //showMsg("添加中，请稍后...");
        //                    },
        //                    complete: function () {
        //                        //d.close().remove();
        //                    },
        //                    success: function (result) {
        //                        //toLowerCase报错
        //                        //var status = result.Status.toLowerCase();
        //                        var status = result.Status;
        //                        if (status == true || status == "true" || status == "True") {
        //                            //关闭当前
        //                            top.dialog.list["show_add_client"].close().remove();
        //                            //打开列表
        //                            show_business();

        //                        } else {
        //                            showMsg("系统异常，客户添加失败！", "Error");
        //                        }
        //                    },
        //                    error: function () {
        //                        showMsg("网络连接错误!", "错误提示", "Error");
        //                    }
        //                });
        //                //必须有这个，阻止刷新
        //                return false;
        //            });
        //        }
        function show_add() {
            showTopWindow("show_add_client", "/Customer/ClientInfo/Edit?actionType=Add", null, 800, 380, function () {
                var client_form = $(top.window.frames["frm_show_add_client"].document).find("#clientinfo_form");
                var flag = top.document.getElementById("frm_show_add_client").contentWindow.form_valid();
                if (!flag) {
                    return false;
                }
                var number1 = top.window.frames["frm_show_add_client"].document.getElementById("ClientTel1").value;
                //var data = $(client_form).serializeObject();
                var data = $(client_form).serialize();
                //console.log(data);
                //return;
                $.ajax({
                    type: "POST",
                    cache: false,
                    url: "/api/ClientInfoApi/AddClientInfo/",
                    data: data,
                    dataType: "json",
                    beforeSend: function () {
                        //showMsg("添加中，请稍后...");
                    },
                    complete: function () {
                        //d.close().remove();
                    },
                    success: function (result) {
                        //toLowerCase报错
                        //var status = result.Status.toLowerCase();
                        var status = result.Status;
                        if (status == true || status == "true" || status == "True") {
                            //关闭当前
                            top.dialog.list["show_add_client"].close().remove();
                            //打开列表
                            show_business();
                            showTopMsg("客户添加成功！", "温馨提示", "Success");
                        } else {
                            showMsg("系统异常，客户添加失败！", "Error");
                        }
                    },
                    error: function () {
                        showMsg("网络连接错误!", "错误提示", "Error");
                    }
                });
                //必须有这个，阻止刷新
                return false;
            });
        }
        //添加月嫂订单界面
        function show_add_yuesao(id) {
            showTopContentWindow("show_add_yuesao", "/Order/YuesaoOrder/AddYuesao?actionType=Add", "添加月嫂订单", 1000,550, function () {

                var yuesaoorder_form = $(top.window.frames["frm_show_order_add"].document).find("#step4_form");
                //console.log(yuesaoorder_form);
                var flag = top.window.document.getElementById("frm_show_order_add").contentWindow.form_valid();
                if (!flag) {
                    return false;
                }
                if (!flag) {
                    return false;
                }
                var data = $(yuesaoorder_form).serialize();
                //console.log(data);
                //alert(data);
                $.ajax({
                    type: "POST",
                    cache: false,
                    url: "/api/YuesaoOrder/MobileAddYuesao?id=" + id,
                    data: data,
                    dataType: "json",
                    beforeSend: function () {
                        //显示加载中
                        showTopDialog("show_loading", "<div class='dialog_loading'>月嫂订单确认中，请稍后...</div>", "温馨提示", 400, 95);
                    },
                    complete: function () {
                    },
                    success: function (result) {
                        top.dialog.list["show_loading"].close().remove();
                        //toLowerCase报错
                        //var status = result.Status.toLowerCase();
                        var status = result.Status;
                        if (status == true || status == "true" || status == "True") {
                            //刷新数据
                            top.dialog.list["show_add_yuesao"].close().remove();
                            show_do_order_success();
                            order_grid.bootgrid("reload");
                        } else {
                            showMsg("系统异常，订单确认失败！", "Error");
                        }
                    },
                    error: function () {
                        top.dialog.list["show_loading"].close().remove();
                        showMsg("网络连接错误!", "错误提示", "Error");
                    }
                });
                //必须有这个，阻止刷新
                return false;
            }, function () { });
        }
        //添加育婴师订单界面
        function show_add_yingshi(id) {
            showTopContentWindow("show_add_yingshi", "/Order/YingshiOrder/AddYingshi?actionType=Add", "添加育婴师订单", 1000, 550, function () {

                var yuesaoorder_form = $(top.window.frames["frm_show_order_add"].document).find("#step4_form");
                //console.log(yuesaoorder_form);
                var flag = top.window.document.getElementById("frm_show_order_add").contentWindow.form_valid();
                if (!flag) {
                    return false;
                }

                if (!flag) {
                    return false;
                }
                var data = $(yuesaoorder_form).serialize();
                //console.log(data);

                //alert(data);
                $.ajax({
                    type: "POST",
                    cache: false,
                    url: "/api/YingshiOrder/AddYuesao?id=" + id,
                    data: data,
                    dataType: "json",
                    beforeSend: function () {
                        //显示加载中
                        showTopDialog("show_loading", "<div class='dialog_loading'>月嫂订单确认中，请稍后...</div>", "温馨提示", 400, 95);
                    },
                    complete: function () {
                    },
                    success: function (result) {
                        top.dialog.list["show_loading"].close().remove();
                        //toLowerCase报错
                        //var status = result.Status.toLowerCase();
                        var status = result.Status;
                        if (status == true || status == "true" || status == "True") {
                            //刷新数据
                            top.dialog.list["show_add_yingshi"].close().remove();
                            show_do_order_success();
                            order_grid.bootgrid("reload");
                        } else {
                            showMsg("系统异常，订单确认失败！", "Error");
                        }
                    },
                    error: function () {
                        top.dialog.list["show_loading"].close().remove();
                        showMsg("网络连接错误!", "错误提示", "Error");
                    }
                });
                //必须有这个，阻止刷新
                return false;
            }, function () { });
        }
        //添加月子会所订单界面
        function show_add_huisuo(id) {
            showTopContentWindow("show_add_huisuo", "/Order/Corder/AddHuisuoInfo?actionType=Add", "添加月子会所订单", 1000, 500, function () {
                var yuesaoorder_form = $(top.window.frames["frm_show_order_add"].document).find("#step4_form");
                //console.log(yuesaoorder_form);
                var flag = top.window.document.getElementById("frm_show_order_add").contentWindow.form_valid();
                if (!flag) {
                    return false;
                }
                if (!flag) {
                    return false;
                }
                var data = $(yuesaoorder_form).serialize();
                //console.log(data);
                //alert(data);
                $.ajax({
                    type: "POST",
                    cache: false,
                    url: "/api/Corder/AddHuisuoInfo?id=" + id,
                    data: data,
                    dataType: "json",
                    beforeSend: function () {
                        //显示加载中
                        showTopDialog("show_loading", "<div class='dialog_loading'>月嫂订单确认中，请稍后...</div>", "温馨提示", 400, 95);
                    },
                    complete: function () {
                    },
                    success: function (result) {
                        top.dialog.list["show_loading"].close().remove();
                        //toLowerCase报错
                        //var status = result.Status.toLowerCase();
                        var status = result.Status;
                        if (status == true || status == "true" || status == "True") {
                            //刷新数据
                            top.dialog.list["show_add_yingshi"].close().remove();
                            show_do_order_success();
                            order_grid.bootgrid("reload");
                        } else {
                            showMsg("系统异常，订单确认失败！", "Error");
                        }
                    },
                    error: function () {
                        top.dialog.list["show_loading"].close().remove();
                        showMsg("网络连接错误!", "错误提示", "Error");
                    }
                });
                //必须有这个，阻止刷新
                return false;
            }, function () { });
        }
    </script>
    <!--固定顶部部分 开始-->
    <div class="header clearfix">
        <a href="javascript:void(0);" class="current-nav" style="display: block;"><em class="menu-more-ico">
        </em><span id="g_mod_name">客户管理</span> </a>
        <div class="vh-avator-area">
            <div class="gl-lang-container">
                <div class="account-avator">
                    <div class="account-avator-bg">
                    </div>
                </div>
                <span class="account-name" id="g_username2">@Session[EdKeys.SESSION_USER_NAME]（<b>@Session[EdKeys.SESSION_ROLE_NAME]</b>）<a
                    href="/Account/Login/Logout/">安全退出</a></span>
            </div>
        </div>
    </div>
    <!--固定顶部部分 结束-->
    <!--主页主题部分 开始-->
    <div class="main">
        <div class="main-container">
            <ul>
                @if (Html.LoadModulePowers(@Model, "order_add_yuesao"))
                {
                    <li onclick="show_add_yuesao();">
                        <img src="~/Themes/default/home/images/选月嫂.png"><span>选月嫂</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "order_add_yingshi"))
                {
                    <li onclick="show_add_yingshi();">
                        <img src="~/Themes/default/home/images/选育婴师.png"><span>选育婴师</span></li>
                }
                @if (Html.LoadModulePowers(@Model, "order_add_huisuo"))
                {
                    <li onclick="show_add_huisuo();">
                        <img src="~/Themes/default/home/images/找月子会所.png"><span>找月子会所</span></li>
                }
                <div style="clear: both;">
                </div>
            </ul>
        </div>
    </div>
    <!--主页主题部分 结束-->
    <!--侧栏导航-->
    <ul class="sidebar">
        <li><a href="/">
            <img src="~/Themes/default/home/images/btn_06.png"><span>主页</span></a></li>
        @*@if (Html.LoadModulePowers(@Model, "Customer"))
        {
            <li><a href="/Home/Main/Customer/">
                <img src="~/Themes/default/home/images/home_btn_03.png"><span>客户管理</span></a></li>
        }*@  
        @if (Html.LoadModulePowers(@Model, "Order_add"))
        {
            <li><a href="/Order/Order/OrderAdd/" >
                <img src="~/Themes/default/home/images/order_01.png" /><span>新增订单</span></a></li>
        }
        @if (Html.LoadModulePowers(@Model, "Order"))
        {
            <li><a href="/Home/Main/Order/" >
                <img src="~/Themes/default/home/images/home_btn_05.png" /><span>订单管理</span></a></li> 
        }
        @if (Html.LoadModulePowers(@Model, "Yuangong"))
        {
            <li><a href="/Home/Main/Yuangong/">
                <img src="~/Themes/default/home/images/home_btn_07.png" /><span>员工管理</span></a></li> 
        }
        @if (Html.LoadModulePowers(@Model, "Finance"))
        {
            <li><a href="/Home/Main/Finance/" >
                <img src="~/Themes/default/home/images/home_btn_09.png" /><span>财务信息</span></a></li> 
        }
        @if (Html.LoadModulePowers(@Model, "Settings"))
        {
            <li><a href="/Home/Main/Seting/" >
                <img src="~/Themes/default/home/images/home_btn_11.png" /><span>系统设置</span></a></li>
        }
      
    </ul>
</body>
</html>
